package com.maple.admin.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.maple.admin.common.util.AjaxJson;
import com.maple.admin.domain.entity.Apply;
import com.maple.admin.domain.entity.Order;
import com.maple.admin.service.ApplyService;
import io.swagger.annotations.Api;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/apply")
@Api(value = "apply", tags = "售后模块")
public class ApplyController {

    @Resource
    private ApplyService applyService;

    @GetMapping("/list")
    public AjaxJson selectAll(){

        return  AjaxJson.getSuccessData(applyService.list());
    }

    @PostMapping("/save")
    public AjaxJson saveOrder(@RequestBody Apply apply){

        return  AjaxJson.getSuccessData(applyService.saveOrUpdate(apply));
    }

    @GetMapping("/delete/{aid}")
    @Transactional
    public AjaxJson delete(@PathVariable Integer aid){

        return AjaxJson.getSuccessData(applyService.removeById(aid));
    }


}
